package de.bazinga.rotw.treasure;

import com.captiveimagination.jgn.message.Message;
import com.captiveimagination.jgn.message.type.CertifiedMessage;
import com.captiveimagination.jgn.message.type.PlayerMessage;
import com.captiveimagination.jgn.message.type.TimestampedMessage;

import de.bazinga.rotw.game.RotwGameState;
import de.bazinga.rotw.network.message.GameMessage;

public class TreasureWonMessage extends Message implements CertifiedMessage, PlayerMessage, TimestampedMessage, GameMessage {
	
	private String playerName = "";
	
	private boolean isPlayer = false;
	
	public void handleMessage(RotwGameState game, Message msg, boolean server) {
		if(!(msg instanceof TreasureWonMessage)) return ;

		//TreasureWonMessage message = (TreasureWonMessage)msg;
		
		if(server) {
			// should never happen
		}else{
			Treasure.foundAllTreasures(isPlayer, playerName);
		}	
	}

	public void setPlayerName(String playerName) {
		this.playerName = playerName;
	}

	public String getPlayerName() {
		return playerName;
	}

	public void setIsPlayer(boolean isPlayer) {
		this.isPlayer = isPlayer;
	}

	public boolean isPlayer() {
		return isPlayer;
	}
	
}